#include "Camera.h"


CCamera::CCamera(void)
{
	m_Position = new CVector(0.0f, 0.0f, 0.0f);
	m_Target = new CVector(0.0f, 0.0f, 1.0f);
	m_Up = new CVector(0.0f, 1.0f, 0.0f);
	m_NearPlane = 1.0f;
	m_FarPlane = 1000.0f;
	m_Fov = 60.0f;
	m_ViewPlane = new COutImage(256, 256);
	CountPixelDimensions();
}

CCamera::CCamera(CVector _pos, CVector _tgt)
{
	m_Position = new CVector(_pos);
	m_Target = new CVector(_tgt);
	m_Up = new CVector(0.0f, 1.0f, 0.0f);
	m_NearPlane = 1.0f;
	m_FarPlane = 1000.0f;
	m_Fov = 60.0f;
	m_ViewPlane = new COutImage(256, 256);
	CountPixelDimensions();
}

CCamera::CCamera(CVector _pos, CVector _tgt, CVector _up, float _np, float _fp, float _fov)
{
	m_Position = new CVector(_pos);
	m_Target = new CVector(_tgt);
	m_Up = new CVector(_up);
	m_NearPlane = _np;
	m_FarPlane = _fp;
	m_Fov = _fov;
	m_ViewPlane = new COutImage(256, 256);
	CountPixelDimensions();
}

CCamera::~CCamera(void)
{
}

void CCamera::SetViewPlane(int _w, int _h)
{
	delete m_ViewPlane;

	m_ViewPlane = new COutImage(_w, _h);
	CountPixelDimensions();
}

void CCamera::CountPixelDimensions()
{
	m_PixelWidth = 1.0f / m_ViewPlane->GetWidth();
	m_PixelHeight = 1.0f / m_ViewPlane->GetHeight();
}